﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:Converters="using:Windows8Accelerator.Core.Xaml.Converters"
    xmlns:Controls="using:Windows8Accelerator.Core.Xaml.Controls"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SimpleRssReader">

    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="Default">
            <x:String x:Key="ProgressBarIndeterminateForegroundThemeBrush">#FFFFFFFF</x:String>
        </ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>

    <Converters:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />
    <Converters:StringToImageConverter x:Key="StringToImageConverter" UseCache="True" />

    <DataTemplate x:Key="FullScreenLandscapePageHeaderTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="BackButton" Style="{Binding BackButtonStyle}" Command="{Binding BackButtonCommand}"/>
            <StackPanel Orientation="Horizontal" Grid.Column="1" VerticalAlignment="Bottom" >
                <Image Source="ms-appx:///Assets/Imagens/LogoHeader.png" Stretch="None" Margin="0,0,10,38" Visibility="Collapsed"/>
                <TextBlock Text="RSS Reader " Style="{Binding PageTitleStyle}"/>
                <TextBlock Text="{Binding Content}" Style="{Binding PageTitleStyle}" TextTrimming="WordEllipsis"/>
            </StackPanel>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="SnappedHomePageHeaderTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="BackButton" Style="{Binding BackButtonStyle}" Command="{Binding BackButtonCommand}"/>
            <StackPanel Orientation="Horizontal" Grid.Column="1" VerticalAlignment="Bottom" >
                <Image Source="ms-appx:///Assets/Imagens/LogoHeader.png" Stretch="None" Margin="0,0,10,10"/>
                <TextBlock Text="RSS Reader " Style="{Binding PageTitleStyle}"/>
                <TextBlock Text="{Binding Content}" Style="{Binding PageTitleStyle}" TextTrimming="WordEllipsis"/>
            </StackPanel>
        </Grid>
    </DataTemplate>   
    
    <DataTemplate x:Key="SnappedPageHeaderTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="BackButton" Style="{Binding BackButtonStyle}" Command="{Binding BackButtonCommand}"/>
            <StackPanel Orientation="Horizontal" Grid.Column="1" VerticalAlignment="Bottom" >
                <Image Source="ms-appx:///Assets/Imagens/LogoHeader.png" Stretch="None" Margin="0,0,10,10"/>
                <TextBlock Text="RSS " Style="{Binding PageTitleStyle}"/>
                <TextBlock Text="{Binding Content}" Style="{Binding PageTitleStyle}" TextTrimming="WordEllipsis"/>
            </StackPanel>
        </Grid>
    </DataTemplate>
    
    <Style TargetType="Controls:SuperSilhouette" >
        <Setter Property="Background" Value="#333333" />
        <Setter Property="FullScreenLandscapeHeaderTemplate" Value="{StaticResource FullScreenLandscapePageHeaderTemplate}" />
        <Setter Property="SnappedHeaderTemplate" Value="{StaticResource SnappedPageHeaderTemplate}" />
    </Style>
    
    <DataTemplate x:Key="PostTemplate">
        <Grid>
            <Rectangle Fill="#FF222222"/>
            <Image Source="{Binding Image, Converter={StaticResource StringToImageConverter}}" Stretch="UniformToFill"/>
            <Rectangle Fill="#CC222222"/>
            <Grid Margin="8">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <RichTextBlock TextTrimming="WordEllipsis" TextWrapping="Wrap" IsTextSelectionEnabled="False">
                    <Paragraph>
                        <Run Text="{Binding Title}" Foreground="White" FontWeight="SemiBold"/>
                        <LineBreak />
                        <Run Text="{Binding Summary}" Foreground="White" FontWeight="Normal"/>
                    </Paragraph>
                </RichTextBlock>
                <TextBlock Text="{Binding Date}" Foreground="#FF868686" TextTrimming="WordEllipsis" Grid.Row="1" Style="{StaticResource CaptionTextStyle}"/>
            </Grid>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="PostTemplateSnapped">
        <Grid>
            <Rectangle Fill="#FF222222"/>
            <Grid Margin="8">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <RichTextBlock TextTrimming="WordEllipsis" TextWrapping="Wrap" IsTextSelectionEnabled="False">
                    <Paragraph>
                        <Run Text="{Binding Title}" Foreground="White" FontWeight="SemiBold"/>
                    </Paragraph>
                </RichTextBlock>
                <TextBlock Text="{Binding Date}" Foreground="#FF868686" TextTrimming="WordEllipsis" Grid.Row="1" Style="{StaticResource CaptionTextStyle}"/>
            </Grid>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="BlogHeaderTemplate">
        <Grid Margin="4,-7,10,16">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" Style="{StaticResource GroupHeaderTextStyle}" Foreground="White" />
            </StackPanel>
        </Grid>
    </DataTemplate>
    
    <DataTemplate x:Key="BlogTemplate">
        <Grid Background="#10FFFFFF">
            <TextBlock Margin="8" Text="{Binding Name}"  Style="{StaticResource GroupHeaderTextStyle}" Foreground="White"/>
        </Grid>
    </DataTemplate>
</ResourceDictionary>
